<template>
  <div>
    <dettail-banner :listname="headername" :listbanner="headerbanner" :listgallery="headergallery"></dettail-banner>
    <detail-booking></detail-booking>
    <detail-header></detail-header>
  </div>
</template>

<script>
import DettailBanner from './components/dettailbanner.vue'
import DetailBooking from './components/Bookingtickets.vue'
import DetailHeader from './components/detailheader.vue'
import axios from 'axios'
export default { //  组件配置项
  name: 'detail',
  components: {
    DettailBanner,
    DetailBooking,
    DetailHeader
  },
  data () {
    return {
      headername: "",
      headerbanner: "",
      headergallery: []
    }
  },
  mounted () {
    axios.get('/localdata/detail.json', {
        params: {
          ID: this.$route.params.id
        }
      })
      .then((res) => {
        console.log(res)
        let datajson=res.data         //保存json数据

        let datalist=datajson.data    //获取列表数据
        console.log(datalist)
        if (datajson.ret && datalist) {
          this.headername=datalist.spotname
          console.log(this.headername)
          this.headerbanner=datalist.bannerimg
          this.headergallery=datalist.galleryimg
        }
      })
      .catch((error) => {
        console.log(error);
      });
  }
}
</script>

<style lang="stylus" scoped="scoped">
</style>
